home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261a.zoo / info / iostream < prev    next >
Encoding:
GNU Info File  |  1994-11-07  |  67.6 KB  |  1,809 lines

  1. This is Info file iostream, produced by Makeinfo-1.55 from the input
  2. file iostream.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * iostream: (iostream).                    The C++ input/output facility.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file describes libio, the GNU library for C++ iostreams and C
  9. stdio.
  10.  
  11.    libio includes software developed by the University of California,
  12. Berkeley.
  13.  
  14.    Copyright (C) 1993 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the entire resulting derived work is distributed under the terms
  23. of a permission notice identical to this one.
  24.  
  25.    Permission is granted to copy and distribute translations of this
  26. manual into another language, under the above conditions for modified
  27. versions.
  28.  
  29. File: iostream,  Node: Top,  Next: Introduction,  Prev: (DIR),  Up: (DIR)
  30.  
  31. The GNU C++ Iostream Library
  32. ****************************
  33.  
  34.    This file provides reference information on the GNU C++ iostream
  35. library (`libio'), version 0.64.
  36.  
  37. * Menu:
  38.  
  39. * Introduction::
  40. * Operators::            Operators and default streams.
  41. * Streams::            Stream classes.
  42. * Files and Strings::        Classes for files and strings.
  43. * Streambuf::            Using the streambuf layer.
  44. * Stdio::            C input and output.
  45. * Index::
  46.  
  47. File: iostream,  Node: Introduction,  Next: Operators,  Prev: Top,  Up: Top
  48.  
  49. Introduction
  50. ************
  51.  
  52.    The iostream classes implement most of the features of AT&T version
  53. 2.0 iostream library classes, and most of the features of the ANSI X3J16
  54. library draft (which is based on the AT&T design).
  55.  
  56.    This manual is meant as a reference; for tutorial material on
  57. iostreams, see the corresponding section of any recent popular
  58. introduction to C++.
  59.  
  60. * Menu:
  61.  
  62. * Copying::        Special GNU licensing terms for libio.
  63. * Acknowledgements::    Contributors to GNU iostream.
  64.  
  65. File: iostream,  Node: Copying,  Next: Acknowledgements,  Up: Introduction
  66.  
  67. Licensing terms for `libio'
  68. ===========================
  69.  
  70.    Since the `iostream' classes are so fundamental to standard C++, the
  71. Free Software Foundation has agreed to a special exception to its
  72. standard license, when you link programs with `libio.a':
  73.  
  74.      As a special exception, if you link this library with files
  75.      compiled with a GNU compiler to produce an executable, this does
  76.      not cause the resulting executable to be covered by the GNU
  77.      General Public License.  This exception does not however
  78.      invalidate any other reasons why the executable file might be
  79.      covered by the GNU General Public License.
  80.  
  81.    The code is under the GNU General Public License (version 2) for all
  82. other purposes than linking with this library; that means that you can
  83. modify and redistribute the code as usual, but remember that if you do,
  84. your modifications, and anything you link with the modified code, must
  85. be available to others on the same terms.
  86.  
  87.    These functions are also available as part of the `libg++' library;
  88. if you link with that library instead of `libio', the GNU Library
  89. General Public License applies.
  90.  
  91. File: iostream,  Node: Acknowledgements,  Prev: Copying,  Up: Introduction
  92.  
  93. Acknowledgements
  94. ================
  95.  
  96.    Per Bothner wrote most of the `iostream' library, but some portions
  97. have their origins elsewhere in the free software community.  Heinz
  98. Seidl wrote the IO manipulators.  The floating-point conversion software
  99. is by David M. Gay of AT&T.  Some code was derived from parts of BSD
  100. 4.4, which was written at the University of California, Berkeley.
  101.  
  102.    The iostream classes are found in the `libio' library.  An early
  103. version was originally distributed in `libg++', and they are still
  104. included there as well, for convenience if you need other `libg++'
  105. classes.  Doug Lea was the original author of `libg++', and some of the
  106. file-management code still in `libio' is his.
  107.  
  108.    Various people found bugs or offered suggestions.  Hongjiu Lu worked
  109. hard to use the library as the default stdio implementation for Linux,
  110. and has provided much stress-testing of the library.
  111.  
  112. File: iostream,  Node: Operators,  Next: Streams,  Prev: Introduction,  Up: Top
  113.  
  114. Operators and Default Streams
  115. *****************************
  116.  
  117.    The GNU iostream library, `libio', implements the standard input and
  118. output facilities for C++.  These facilities are roughly analogous (in
  119. their purpose and ubiquity, at least) with those defined by the C
  120. `stdio' functions.
  121.  
  122.    Although these definitions come from a library, rather than being
  123. part of the "core language", they are sufficiently central to be
  124. specified in the latest working papers for C++.
  125.  
  126.    You can use two operators defined in this library for basic input and
  127. output operations.  They are familiar from any C++ introductory
  128. textbook: `<<' for output, and `>>' for input.  (Think of data flowing
  129. in the direction of the "arrows".)
  130.  
  131.    These operators are often used in conjunction with three streams that
  132. are open by default:
  133.  
  134.  - Variable: ostream cout
  135.      The standard output stream, analogous to the C `stdout'.
  136.  
  137.  - Variable: istream cin
  138.      The standard input stream, analogous to the C `stdin'.
  139.  
  140.  - Variable: ostream cerr
  141.      An alternative output stream for errors, analogous to the C
  142.      `stderr'.
  143.  
  144. For example, this bare-bones C++ version of the traditional "hello"
  145. program uses `<<' and `cout':
  146.  
  147.      #include <iostream.h>
  148.      
  149.      int main(int argc, char **argv)
  150.      {
  151.        cout << "Well, hi there.\n";
  152.        return 0;
  153.      }
  154.  
  155.    Casual use of these operators may be seductive, but--other than in
  156. writing throwaway code for your own use--it is not necessarily simpler
  157. than managing input and output in any other language.  For example,
  158. robust code should check the state of the input and output streams
  159. between operations (for example, using the method `good').  *Note
  160. Checking the state of a stream: States.  You may also need to adjust
  161. maximum input or output field widths, using manipulators like `setw' or
  162. `setprecision'.
  163.  
  164.  - Operator on ostream: <<
  165.      Write output to an open output stream of class `ostream'.  Defined
  166.      by this library on any OBJECT of a C++ primitive type, and on
  167.      other classes of the library.  You can overload the definition for
  168.      any of your own applications' classes.
  169.  
  170.      Returns a reference to the implied argument `*this' (the open
  171.      stream it writes on), permitting statements like
  172.           cout << "The value of i is " << i << "\n";
  173.  
  174.  - Operator on istream: >>
  175.      Read input from an open input stream of class `istream'.  Defined
  176.      by this library on primitive numeric, pointer, and string types;
  177.      you can extend the definition for any of your own applications'
  178.      classes.
  179.  
  180.      Returns a reference to the implied argument `*this' (the open
  181.      stream it reads), permitting multiple inputs in one statement.
  182.  
  183. File: iostream,  Node: Streams,  Next: Files and Strings,  Prev: Operators,  Up: Top
  184.  
  185. Stream Classes
  186. **************
  187.  
  188.    The previous chapter referred in passing to the classes `ostream'
  189. and `istream', for output and input respectively.  These classes share
  190. certain properties, captured in their base class `ios'.
  191.  
  192. * Menu:
  193.  
  194. * Ios::       Shared properties.
  195. * Ostream::   Managing output streams.
  196. * Istream::   Managing input streams.
  197. * Iostream::  Input and output together.
  198.  
  199. File: iostream,  Node: Ios,  Next: Ostream,  Up: Streams
  200.  
  201. Shared properties: class `ios'
  202. ==============================
  203.  
  204.    The base class `ios' provides methods to test and manage the state
  205. of input or output streams.
  206.  
  207.    `ios' delegates the job of actually reading and writing bytes to the
  208. abstract class `streambuf', which is designed to provide buffered
  209. streams (compatible with C, in the GNU implementation).  *Note Using
  210. the `streambuf' layer: Streambuf, for information on the facilities
  211. available at the `streambuf' level.
  212.  
  213.  - Constructor:  ios::ios ([streambuf* SB [, ostream* TIE])
  214.      The `ios' constructor by default initializes a new `ios', and if
  215.      you supply a `streambuf' SB to associate with it, sets the state
  216.      `good' in the new `ios' object.  It also sets the default
  217.      properties of the new object.
  218.  
  219.      You can also supply an optional second argument TIE to the
  220.      constructor: if present, it is an initial value for `ios::tie', to
  221.      associate the new `ios' object with another stream.
  222.  
  223.  - Destructor:  ios::~ios ()
  224.      The `ios' destructor is virtual, permitting application-specific
  225.      behavior when a stream is closed--typically, the destructor frees
  226.      any storage associated with the stream and releases any other
  227.      associated objects.
  228.  
  229. * Menu:
  230.  
  231. * States::        Checking the state of a stream.
  232. * Format Control::    Choices in formatting.
  233. * Manipulators::    Convenient ways of changing stream properties.
  234. * Extending::        Extended data fields.
  235. * Synchronization::    Synchronizing related streams.
  236. * Streambuf from Ios::    Reaching the underlying streambuf.
  237.  
  238. File: iostream,  Node: States,  Next: Format Control,  Up: Ios
  239.  
  240. Checking the state of a stream
  241. ------------------------------
  242.  
  243.    Use this collection of methods to test for (or signal) errors and
  244. other exceptional conditions of streams:
  245.  
  246.  - Method: ios::operator void* () const
  247.      You can do a quick check on the state of the most recent operation
  248.      on a stream by examining a pointer to the stream itself.  The
  249.      pointer is arbitrary except for its truth value; it is true if no
  250.      failures have occurred (`ios::fail' is not true).  For example,
  251.      you might ask for input on `cin' only if all prior output
  252.      operations succeeded:
  253.  
  254.           if (cout)
  255.           {
  256.             // Everything OK so far
  257.             cin >> new_value;
  258.             ...
  259.           }
  260.  
  261.  - Method: ios::operator ! () const
  262.      In case it is more convenient to check whether something has
  263.      failed, the operator `!' returns true if `ios::fail' is true (an
  264.      operation has failed).  For example, you might issue an error
  265.      message if input failed:
  266.  
  267.           if (!cin)
  268.           {
  269.             // Oops
  270.             cerr << "Eh?\n";
  271.           }
  272.  
  273.  - Method: iostate ios::rdstate () const
  274.      Return the state flags for this stream.  The value is from the
  275.      enumeration `iostate'.  You can test for any combination of
  276.  
  277.     `goodbit'
  278.           There are no indications of exceptional states on this stream.
  279.  
  280.     `eofbit'
  281.           End of file.
  282.  
  283.     `failbit'
  284.           An operation has failed on this stream; this usually
  285.           indicates bad format of input.
  286.  
  287.     `badbit'
  288.           The stream is unusable.
  289.  
  290.  - Method: void ios::setstate (iostate STATE)
  291.      Set the state flag for this stream to STATE *in addition to* any
  292.      state flags already set.  Synonym (for upward compatibility):
  293.      `ios::set'.
  294.  
  295.      See `ios::clear' to set the stream state without regard to existing
  296.      state flags.  See `ios::good', `ios::eof', `ios::fail', and
  297.      `ios::bad', to test the state.
  298.  
  299.  - Method: int ios::good () const
  300.      Test the state flags associated with this stream; true if no error
  301.      indicators are set.
  302.  
  303.  - Method: int ios::bad () const
  304.      Test whether a stream is marked as unusable.  (Whether
  305.      `ios::badbit' is set.)
  306.  
  307.  - Method: int ios::eof () const
  308.      True if end of file was reached on this stream.  (If `ios::eofbit'
  309.      is set.)
  310.  
  311.  - Method: int ios::fail () const
  312.      Test for any kind of failure on this stream: *either* some
  313.      operation failed, *or* the stream is marked as bad.  (If either
  314.      `ios::failbit' or `ios::badbit' is set.)
  315.  
  316.  - Method: void ios::clear (iostate STATE)
  317.      Set the state indication for this stream to the argument STATE.
  318.      You may call `ios::clear' with no argument, in which case the state
  319.      is set to `good' (no errors pending).
  320.  
  321.      See `ios::good', `ios::eof', `ios::fail', and `ios::bad', to test
  322.      the state; see `ios::set' or `ios::setstate' for an alternative
  323.      way of setting the state.
  324.  
  325. File: iostream,  Node: Format Control,  Next: Manipulators,  Prev: States,  Up: Ios
  326.  
  327. Choices in formatting
  328. ---------------------
  329.  
  330.    These methods control (or report on) settings for some details of
  331. controlling streams, primarily to do with formatting output:
  332.  
  333.  - Method: char ios::fill () const
  334.      Report on the padding character in use.
  335.  
  336.  - Method: char ios::fill (char PADDING)
  337.      Set the padding character.  You can also use the manipulator
  338.      `setfill'.  *Note Changing stream properties in expressions:
  339.      Manipulators.
  340.  
  341.      Default: blank.
  342.  
  343.  - Method: int ios::precision () const
  344.      Report the number of significant digits currently in use for
  345.      output of floating point numbers.
  346.  
  347.      Default: `6'.
  348.  
  349.  - Method: int ios::precision (int SIGNIF)
  350.      Set the number of significant digits (for input and output numeric
  351.      conversions) to SIGNIF.
  352.  
  353.      You can also use the manipulator `setprecision' for this purpose.
  354.      *Note Changing stream properties using manipulators: Manipulators.
  355.  
  356.  - Method: int ios::width () const
  357.      Report the current output field width setting (the number of
  358.      characters to write on the next `<<' output operation).
  359.  
  360.      Default: `0', which means to use as many characters as necessary.
  361.  
  362.  - Method: int ios::width (int NUM)
  363.      Set the input field width setting to NUM.  Return the *previous*
  364.      value for this stream.
  365.  
  366.      This value resets to zero (the default) every time you use `<<';
  367.      it is essentially an additional implicit argument to that
  368.      operator.  You can also use the manipulator `setw' for this
  369.      purpose.  *Note Changing stream properties using manipulators:
  370.      Manipulators.
  371.  
  372.  - Method: fmtflags ios::flags () const
  373.      Return the current value of the complete collection of flags
  374.      controlling the format state.  These are the flags and their
  375.      meanings when set:
  376.  
  377.     `ios::dec'
  378.     `ios::oct'
  379.     `ios::hex'
  380.           What numeric base to use in converting integers from internal
  381.           to display representation, or vice versa: decimal, octal, or
  382.           hexadecimal, respectively.  (You can change the base using
  383.           the manipulator `setbase', or any of the manipulators `dec',
  384.           `oct', or `hex'; *note Changing stream properties in
  385.           expressions: Manipulators..)
  386.  
  387.           On input, if none of these flags is set, read numeric
  388.           constants according to the prefix: decimal if no prefix (or a
  389.           `.' suffix), octal if a `0' prefix is present, hexadecimal if
  390.           a `0x' prefix is present.
  391.  
  392.           Default: `dec'.
  393.  
  394.     `ios::fixed'
  395.           Avoid scientific notation, and always show a fixed number of
  396.           digits after the decimal point, according to the output
  397.           precision in effect.  Use `ios::precision' to set precision.
  398.  
  399.     `ios::left'
  400.     `ios::right'
  401.     `ios::internal'
  402.           Where output is to appear in a fixed-width field;
  403.           left-justified, right-justified, or with padding in the
  404.           middle (e.g. between a numeric sign and the associated
  405.           value), respectively.
  406.  
  407.     `ios::scientific'
  408.           Use scientific (exponential) notation to display numbers.
  409.  
  410.     `ios::showbase'
  411.           Display the conventional prefix as a visual indicator of the
  412.           conversion base: no prefix for decimal, `0' for octal, `0x'
  413.           for hexadecimal.
  414.  
  415.     `ios::showpoint'
  416.           Display a decimal point and trailing zeros after it to fill
  417.           out numeric fields, even when redundant.
  418.  
  419.     `ios::showpos'
  420.           Display a positive sign on display of positive numbers.
  421.  
  422.     `ios::skipws'
  423.           Skip white space.  (On by default).
  424.  
  425.     `ios::stdio'
  426.           Flush the C `stdio' streams `stdout' and `stderr' after each
  427.           output operation (for programs that mix C and C++ output
  428.           conventions).
  429.  
  430.     `ios::unitbuf'
  431.           Flush after each output operation.
  432.  
  433.     `ios::uppercase'
  434.           Use upper-case characters for the non-numeral elements in
  435.           numeric displays; for instance, `0X7A' rather than `0x7a', or
  436.           `3.14E+09' rather than `3.14e+09'.
  437.  
  438.  - Method: fmtflags ios::flags (fmtflags VALUE)
  439.      Set VALUE as the complete collection of flags controlling the
  440.      format state.  The flag values are described under `ios::flags ()'.
  441.  
  442.      Use `ios::setf' or `ios::unsetf' to change one property at a time.
  443.  
  444.  - Method: fmtflags ios::setf (fmtflags FLAG)
  445.      Set one particular flag (of those described for `ios::flags ()';
  446.      return the complete collection of flags *previously* in effect.
  447.      (Use `ios::unsetf' to cancel.)
  448.  
  449.  - Method: fmtflags ios::setf (fmtflags FLAG, fmtflags MASK)
  450.      Clear the flag values indicated by MASK, then set any of them that
  451.      are also in FLAG.  (Flag values are described for `ios::flags
  452.      ()'.)  Return the complete collection of flags *previously* in
  453.      effect.  (See `ios::unsetf' for another way of clearing flags.)
  454.  
  455.  - Method: fmtflags ios::unsetf (fmtflags FLAG)
  456.      Make certain FLAG (a combination of flag values described for
  457.      `ios::flags ()') is not set for this stream; converse of
  458.      `ios::setf'.  Returns the old values of those flags.
  459.  
  460. File: iostream,  Node: Manipulators,  Next: Extending,  Prev: Format Control,  Up: Ios
  461.  
  462. Changing stream properties using manipulators
  463. ---------------------------------------------
  464.  
  465.    For convenience, MANIPULATORS provide a way to change certain
  466. properties of streams, or otherwise affect them, in the middle of
  467. expressions involving `<<' or `>>'.  For example, you might write
  468.  
  469.      cout << "|" << setfill('*') << setw(5) << 234 << "|";
  470.  
  471. to produce `|**234|' as output.
  472.  
  473.  - Manipulator:  ws
  474.      Skip whitespace.
  475.  
  476.  - Manipulator:  flush
  477.      Flush an output stream.  For example, `cout << ... <<flush;' has
  478.      the same effect as `cout << ...; cout.flush();'.
  479.  
  480.  - Manipulator:  endl
  481.      Write an end of line character `\n', then flushes the output
  482.      stream.
  483.  
  484.  - Manipulator:  ends
  485.      Write `\0' (the string terminator character).
  486.  
  487.  - Manipulator:  setprecision (int SIGNIF)
  488.      You can change the value of `ios::precision' in `<<' expressions
  489.      with the manipulator `setprecision(SIGNIF)'; for example,
  490.  
  491.           cout << setprecision(2) << 4.567;
  492.  
  493.      prints `4.6'.  Requires `#include <iomanip.h>'.
  494.  
  495.  - Manipulator:  setw (int N)
  496.      You can change the value of `ios::width' in `<<' expressions with
  497.      the manipulator `setw(N)'; for example,
  498.  
  499.           cout << setw(5) << 234;
  500.  
  501.      prints `  234' with two leading blanks.  Requires `#include
  502.      <iomanip.h>'.
  503.  
  504.  - Manipulator:  setbase (int BASE)
  505.      Where BASE is one of `10' (decimal), `8' (octal), or `16'
  506.      (hexadecimal), change the base value for numeric representations.
  507.      Requires `#include <iomanip.h>'.
  508.  
  509.  - Manipulator:  dec
  510.      Select decimal base; equivalent to `setbase(10)'.
  511.  
  512.  - Manipulator:  hex
  513.      Select hexadecimal base; equivalent to `setbase(16)'.
  514.  
  515.  - Manipulator:  oct
  516.      Select octal base; equivalent to `setbase(8)'.
  517.  
  518.  - Manipulator:  setfill (char PADDING)
  519.      Set the padding character, in the same way as `ios::fill'.
  520.      Requires `#include <iomanip.h>'.
  521.  
  522. File: iostream,  Node: Extending,  Next: Synchronization,  Prev: Manipulators,  Up: Ios
  523.  
  524. Extended data fields
  525. --------------------
  526.  
  527.    A related collection of methods allows you to extend this collection
  528. of flags and parameters for your own applications, without risk of
  529. conflict between them:
  530.  
  531.  - Method: static fmtflags ios::bitalloc ()
  532.      Reserve a bit (the single bit on in the result) to use as a flag.
  533.      Using `bitalloc' guards against conflict between two packages that
  534.      use `ios' objects for different purposes.
  535.  
  536.      This method is available for upward compatibility, but is not in
  537.      the ANSI working paper.  The number of bits available is limited; a
  538.      return value of `0' means no bit is available.
  539.  
  540.  - Method: static int ios::xalloc ()
  541.      Reserve space for a long integer or pointer parameter.  The result
  542.      is a unique nonnegative integer.  You can use it as an index to
  543.      `ios::iword' or `ios::pword'.  Use `xalloc' to arrange for
  544.      arbitrary special-purpose data in your `ios' objects, without risk
  545.      of conflict between packages designed for different purposes.
  546.  
  547.  - Method: long& ios::iword (int INDEX)
  548.      Return a reference to arbitrary data, of long integer type, stored
  549.      in an `ios' instance.  INDEX, conventionally returned from
  550.      `ios::xalloc', identifies what particular data you need.
  551.  
  552.  - Method: long ios::iword (int INDEX) const
  553.      Return the actual value of a long integer stored in an `ios'.
  554.  
  555.  - Method: void*& ios::pword (int INDEX)
  556.      Return a reference to an arbitrary pointer, stored in an `ios'
  557.      instance.  INDEX, originally returned from `ios::xalloc',
  558.      identifies what particular pointer you need.
  559.  
  560.  - Method: void* ios::pword (int INDEX) const
  561.      Return the actual value of a pointer stored in an `ios'.
  562.  
  563. File: iostream,  Node: Synchronization,  Next: Streambuf from Ios,  Prev: Extending,  Up: Ios
  564.  
  565. Synchronizing related streams
  566. -----------------------------
  567.  
  568.    You can use these methods to synchronize related streams with one
  569. another:
  570.  
  571.  - Method: ostream* ios::tie () const
  572.      Report on what output stream, if any, is to be flushed before
  573.      accessing this one.  A pointer value of `0' means no stream is
  574.      tied.
  575.  
  576.  - Method: ostream* ios::tie (ostream* ASSOC)
  577.      Declare that output stream ASSOC must be flushed before accessing
  578.      this stream.
  579.  
  580.  - Method: int ios::sync_with_stdio ([int SWITCH])
  581.      Unless iostreams and C `stdio' are designed to work together, you
  582.      may have to choose between efficient C++ streams output and output
  583.      compatible with C `stdio'.  Use `ios::sync_with_stdio()' to select
  584.      C compatibility.
  585.  
  586.      The argument SWITCH is a GNU extension; use `0' as the argument to
  587.      choose output that is not necessarily compatible with C `stdio'.
  588.      The default value for SWITCH is `1'.
  589.  
  590.      If you install the `stdio' implementation that comes with GNU
  591.      `libio', there are compatible input/output facilities for both C
  592.      and C++.  In that situation, this method is unnecessary--but you
  593.      may still want to write programs that call it, for portability.
  594.  
  595. File: iostream,  Node: Streambuf from Ios,  Prev: Synchronization,  Up: Ios
  596.  
  597. Reaching the underlying `streambuf'
  598. -----------------------------------
  599.  
  600.    Finally, you can use this method to access the underlying object:
  601.  
  602.  - Method: streambuf* ios::rdbuf () const
  603.      Return a pointer to the `streambuf' object that underlies this
  604.      `ios'.
  605.  
  606. File: iostream,  Node: Ostream,  Next: Istream,  Prev: Ios,  Up: Streams
  607.  
  608. Managing output streams: class `ostream'
  609. ========================================
  610.  
  611.    Objects of class `ostream' inherit the generic methods from `ios',
  612. and in addition have the following methods available.  Declarations for
  613. this class come from `iostream.h'.
  614.  
  615.  - Constructor:  ostream::ostream ()
  616.      The simplest form of the constructor for an `ostream' simply
  617.      allocates a new `ios' object.
  618.  
  619.  - Constructor:  ostream::ostream (streambuf* SB [, ostream TIE])
  620.      This alternative constructor requires a first argument SB of type
  621.      `streambuf*', to use an existing open stream for output.  It also
  622.      accepts an optional second argument TIE, to specify a related
  623.      `ostream*' as the initial value for `ios::tie'.
  624.  
  625.      If you give the `ostream' a `streambuf' explicitly, using this
  626.      constructor, the SB is *not* destroyed (or deleted or closed) when
  627.      the `ostream' is destroyed.
  628.  
  629. * Menu:
  630.  
  631. * Writing::        Writing on an ostream.
  632. * Output Position::    Repositioning an ostream.
  633. * Ostream Housekeeping:: Miscellaneous ostream utilities.
  634.  
  635. File: iostream,  Node: Writing,  Next: Output Position,  Up: Ostream
  636.  
  637. Writing on an `ostream'
  638. -----------------------
  639.  
  640.    These methods write on an `ostream' (you may also use the operator
  641. `<<'; *note Operators and Default Streams: Operators.).
  642.  
  643.  - Method: ostream& ostream::put (char C)
  644.      Write the single character C.
  645.  
  646.  - Method: ostream& ostream::write (STRING, int LENGTH)
  647.      Write LENGTH characters of a string to this `ostream', beginning
  648.      at the pointer STRING.
  649.  
  650.      STRING may have any of these types: `char*', `unsigned char*',
  651.      `signed char*'.
  652.  
  653.  - Method: ostream& ostream::form (const char *FORMAT, ...)
  654.      A GNU extension, similar to `fprintf(FILE, FORMAT, ...)'.
  655.  
  656.      FORMAT is a `printf'-style format control string, which is used to
  657.      format the (variable number of) arguments, printing the result on
  658.      this `ostream'.  See `ostream::vform' for a version that uses an
  659.      argument list rather than a variable number of arguments.
  660.  
  661.  - Method: ostream& ostream::vform (const char *FORMAT, va_list ARGS)
  662.      A GNU extension, similar to `vfprintf(FILE, FORMAT, ARGS)'.
  663.  
  664.      FORMAT is a `printf'-style format control string, which is used to
  665.      format the argument list ARGS, printing the result on this
  666.      `ostream'.  See `ostream::form' for a version that uses a variable
  667.      number of arguments rather than an argument list.
  668.  
  669. File: iostream,  Node: Output Position,  Next: Ostream Housekeeping,  Prev: Writing,  Up: Ostream
  670.  
  671. Repositioning an `ostream'
  672. --------------------------
  673.  
  674.    You can control the output position (on output streams that actually
  675. support positions, typically files) with these methods:
  676.  
  677.  - Method: streampos ostream::tellp ()
  678.      Return the current write position in the stream.
  679.  
  680.  - Method: ostream& ostream::seekp (streampos LOC)
  681.      Reset the output position to LOC (which is usually the result of a
  682.      previous call to `ostream::tellp').  LOC specifies an absolute
  683.      position in the output stream.
  684.  
  685.  - Method: ostream& ostream::seekp (streamoff LOC, REL)
  686.      Reset the output position to LOC, relative to the beginning, end,
  687.      or current output position in the stream, as indicated by REL (a
  688.      value from the enumeration `ios::seekdir'):
  689.  
  690.     `beg'
  691.           Interpret LOC as an absolute offset from the beginning of the
  692.           file.
  693.  
  694.     `cur'
  695.           Interpret LOC as an offset relative to the current output
  696.           position.
  697.  
  698.     `end'
  699.           Interpret LOC as an offset from the current end of the output
  700.           stream.
  701.  
  702. File: iostream,  Node: Ostream Housekeeping,  Prev: Output Position,  Up: Ostream
  703.  
  704. Miscellaneous `ostream' utilities
  705. ---------------------------------
  706.  
  707.    You may need to use these `ostream' methods for housekeeping:
  708.  
  709.  - Method: ostream& flush ()
  710.      Deliver any pending buffered output for this `ostream'.
  711.  
  712.  - Method: int ostream::opfx ()
  713.      `opfx' is a "prefix" method for operations on `ostream' objects;
  714.      it is designed to be called before any further processing.  See
  715.      `ostream::osfx' for the converse.
  716.  
  717.      `opfx' tests that the stream is in state `good', and if so flushes
  718.      any stream tied to this one.
  719.  
  720.      The result is `1' when `opfx' succeeds; else (if the stream state
  721.      is not `good'), the result is `0'.
  722.  
  723.  - Method: void ostream::osfx ()
  724.      `osfx' is a "suffix" method for operations on `ostream' objects;
  725.      it is designed to be called at the conclusion of any processing.
  726.      All the `ostream' methods end by calling `osfx'.  See
  727.      `ostream::opfx' for the converse.
  728.  
  729.      If the `unitbuf' flag is set for this stream, `osfx' flushes any
  730.      buffered output for it.
  731.  
  732.      If the `stdio' flag is set for this stream, `osfx' flushes any
  733.      output buffered for the C output streams `stdout' and `stderr'.
  734.  
  735. File: iostream,  Node: Istream,  Next: Iostream,  Prev: Ostream,  Up: Streams
  736.  
  737. Managing input streams: class `istream'
  738. =======================================
  739.  
  740.    Class `istream' objects are specialized for input; as for `ostream',
  741. they are derived from `ios', so you can use any of the general-purpose
  742. methods from that base class.  Declarations for this class also come
  743. from `iostream.h'.
  744.  
  745.  - Constructor:  istream::istream ()
  746.      When used without arguments, the `istream' constructor simply
  747.      allocates a new `ios' object and initializes the input counter (the
  748.      value reported by `istream::gcount') to `0'.
  749.  
  750.  - Constructor:  istream::istream (streambuf *SB [, ostream TIE])
  751.      You can also call the constructor with one or two arguments.  The
  752.      first argument SB is a `streambuf*'; if you supply this pointer,
  753.      the constructor uses that `streambuf' for input.  You can use the
  754.      second optional argument TIE to specify a related output stream as
  755.      the initial value for `ios::tie'.
  756.  
  757.      If you give the `istream' a `streambuf' explicitly, using this
  758.      constructor, the SB is *not* destroyed (or deleted or closed) when
  759.      the `ostream' is destroyed.
  760.  
  761. * Menu:
  762.  
  763. * Char Input::        Reading one character.
  764. * String Input::    Reading strings.
  765. * Input Position::    Repositioning an istream.
  766. * Istream Housekeeping:: Miscellaneous istream utilities.
  767.  
  768. File: iostream,  Node: Char Input,  Next: String Input,  Up: Istream
  769.  
  770. Reading one character
  771. ---------------------
  772.  
  773.    Use these methods to read a single character from the input stream:
  774.  
  775.  - Method: int istream::get ()
  776.      Read a single character (or `EOF') from the input stream, returning
  777.      it (coerced to an unsigned char) as the result.
  778.  
  779.  - Method: istream& istream::get (char& C)
  780.      Read a single character from the input stream, into `&C'.
  781.  
  782.  - Method: int istream::peek ()
  783.      Return the next available input character, but *without* changing
  784.      the current input position.
  785.  
  786. File: iostream,  Node: String Input,  Next: Input Position,  Prev: Char Input,  Up: Istream
  787.  
  788. Reading strings
  789. ---------------
  790.  
  791.    Use these methods to read strings (for example, a line at a time)
  792. from the input stream:
  793.  
  794.  - Method: istream& istream::get (char* C, int LEN [, char DELIM])
  795.      Read a string from the input stream, into the array at C.
  796.  
  797.      The remaining arguments limit how much to read: up to `len-1'
  798.      characters, or up to (but not including) the first occurrence in
  799.      the input of a particular delimiter character DELIM--newline
  800.      (`\n') by default.  (Naturally, if the stream reaches end of file
  801.      first, that too will terminate reading.)
  802.  
  803.      If DELIM was present in the input, it remains available as if
  804.      unread; to discard it instead, see `iostream::getline'.
  805.  
  806.      `get' writes `\0' at the end of the string, regardless of which
  807.      condition terminates the read.
  808.  
  809.  - Method: istream& istream::get (streambuf& SB [, char DELIM])
  810.      Read characters from the input stream and copy them on the
  811.      `streambuf' object SB.  Copying ends either just before the next
  812.      instance of the delimiter character DELIM (newline `\n' by
  813.      default), or when either stream ends.   If DELIM was present in
  814.      the input, it remains available as if unread.
  815.  
  816.  - Method: istream& istream::getline (CHARPTR, int LEN [, char DELIM])
  817.      Read a line from the input stream, into the array at CHARPTR.
  818.      cHARPTR may be any of three kinds of pointer: `char*', `unsigned
  819.      char*', or `signed char*'.
  820.  
  821.      The remaining arguments limit how much to read: up to (but not
  822.      including) the first occurrence in the input of a line delimiter
  823.      character DELIM--newline (`\n') by default, or up to `len-1'
  824.      characters (or to end of file, if that happens sooner).
  825.  
  826.      If `getline' succeeds in reading a "full line", it also discards
  827.      the trailing delimiter character from the input stream.  (To
  828.      preserve it as available input, see the similar form of
  829.      `iostream::get'.)
  830.  
  831.      If DELIM was *not* found before LEN characters or end of file,
  832.      `getline' sets the `ios::fail' flag, as well as the `ios::eof'
  833.      flag if appropriate.
  834.  
  835.      `getline' writes a null character at the end of the string,
  836.      regardless of which condition terminates the read.
  837.  
  838.  - Method: istream& istream::read (POINTER, int LEN)
  839.      Read LEN bytes into the location at POINTER, unless the input ends
  840.      first.
  841.  
  842.      POINTER may be of type `char*', `void*', `unsigned char*', or
  843.      `signed char*'.
  844.  
  845.      If the `istream' ends before reading LEN bytes, `read' sets the
  846.      `ios::fail' flag.
  847.  
  848.  - Method: istream& istream::gets (char **S [, char DELIM])
  849.      A GNU extension, to read an arbitrarily long string from the
  850.      current input position to the next instance of the DELIM character
  851.      (newline `\n' by default).
  852.  
  853.      To permit reading a string of arbitrary length, `gets' allocates
  854.      whatever memory is required.  Notice that the first argument S is
  855.      an address to record a character pointer, rather than the pointer
  856.      itself.
  857.  
  858.  - Method: istream& istream::scan (const char *format ...)
  859.      A GNU extension, similar to `fscanf(FILE, FORMAT, ...)'.  The
  860.      FORMAT is a `scanf'-style format control string, which is used to
  861.      read the variables in the remainder of the argument list from the
  862.      `istream'.
  863.  
  864.  - Method: istream& istream::vscan (const char *format, va_list args)
  865.      Like `istream::scan', but takes a single `va_list' argument.
  866.  
  867. File: iostream,  Node: Input Position,  Next: Istream Housekeeping,  Prev: String Input,  Up: Istream
  868.  
  869. Repositioning an `istream'
  870. --------------------------
  871.  
  872.    Use these methods to control the current input position:
  873.  
  874.  - Method: streampos istream::tellg ()
  875.      Return the current read position, so that you can save it and
  876.      return to it later with `istream::seekg'.
  877.  
  878.  - Method: istream& istream::seekg (streampos P)
  879.      Reset the input pointer (if the input device permits it) to P,
  880.      usually the result of an earlier call to `istream::tellg'.
  881.  
  882.  - Method: istream& istream::seekg (streamoff OFFSET, ios::seek_dir REF)
  883.      Reset the input pointer (if the input device permits it) to OFFSET
  884.      characters from the beginning of the input, the current position,
  885.      or the end of input.  Specify how to interpret OFFSET with one of
  886.      these values for the second argument:
  887.  
  888.     `ios::beg'
  889.           Interpret LOC as an absolute offset from the beginning of the
  890.           file.
  891.  
  892.     `ios::cur'
  893.           Interpret LOC as an offset relative to the current output
  894.           position.
  895.  
  896.     `ios::end'
  897.           Interpret LOC as an offset from the current end of the output
  898.           stream.
  899.  
  900. File: iostream,  Node: Istream Housekeeping,  Prev: Input Position,  Up: Istream
  901.  
  902. Miscellaneous `istream' utilities
  903. ---------------------------------
  904.  
  905.    Use these methods for housekeeping on `istream' objects:
  906.  
  907.  - Method: int istream::gcount ()
  908.      Report how many characters were read from this `istream' in the
  909.      last unformatted input operation.
  910.  
  911.  - Method: int istream::ipfx (int KEEPWHITE)
  912.      Ensure that the `istream' object is ready for reading; check for
  913.      errors and end of file and flush any tied stream.  `ipfx' skips
  914.      whitespace if you specify `0' as the KEEPWHITE argument, *and*
  915.      `ios::skipws' is set for this stream.
  916.  
  917.      To avoid skipping whitespace (regardless of the `skipws' setting on
  918.      the stream), use `1' as the argument.
  919.  
  920.      Call `istream::ipfx' to simplify writing your own methods for
  921.      reading `istream' objects.
  922.  
  923.  - Method: void istream::isfx ()
  924.      A placeholder for compliance with the draft ANSI standard; this
  925.      method does nothing whatever.
  926.  
  927.      If you wish to write portable standard-conforming code on `istream'
  928.      objects, call `isfx' after any operation that reads from an
  929.      `istream'; if `istream::ipfx' has any special effects that must be
  930.      cancelled when done, `istream::isfx' will cancel them.
  931.  
  932.  - Method: istream& istream::ignore ([int N] [, int DELIM])
  933.      Discard some number of characters pending input.  The first
  934.      optional argument N specifies how many characters to skip.  The
  935.      second optional argument DELIM specifies a "boundary" character:
  936.      `ignore' returns immediately if this character appears in the
  937.      input.
  938.  
  939.      By default, DELIM is `EOF'; that is, if you do not specify a
  940.      second argument, only the count N restricts how much to ignore
  941.      (while input is still available).
  942.  
  943.      If you do not specify how many characters to ignore, `ignore'
  944.      returns after discarding only one character.
  945.  
  946.  - Method: istream& istream::putback (char CH)
  947.      Attempts to back up one character, replacing the character
  948.      backed-up over by CH.  Returns `EOF' if this is not allowed.
  949.      Putting back the most recently read character is always allowed.
  950.      (This method corresponds to the C function `ungetc'.)
  951.  
  952.  - Method: istream& istream::unget ()
  953.      Attempt to back up one character.
  954.  
  955. File: iostream,  Node: Iostream,  Prev: Istream,  Up: Streams
  956.  
  957. Input and output together: class `iostream'
  958. ===========================================
  959.  
  960.    If you need to use the same stream for input and output, you can use
  961. an object of the class `iostream', which is derived from *both*
  962. `istream' and `ostream'.
  963.  
  964.    The constructors for `iostream' behave just like the constructors
  965. for `istream'.
  966.  
  967.  - Constructor:  iostream::iostream ()
  968.      When used without arguments, the `iostream' constructor simply
  969.      allocates a new `ios' object, and initializes the input counter
  970.      (the value reported by `istream::gcount') to `0'.
  971.  
  972.  - Constructor:  iostream::iostream (streambuf* SB [, ostream* TIE])
  973.      You can also call a constructor with one or two arguments.  The
  974.      first argument SB is a `streambuf*'; if you supply this pointer,
  975.      the constructor uses that `streambuf' for input and output.
  976.  
  977.      You can use the optional second argument TIE (an `ostream*') to
  978.      specify a related output stream as the initial value for
  979.      `ios::tie'.
  980.  
  981.    As for `ostream' and `istream', `iostream' simply uses the `ios'
  982. destructor.  However, an `iostream' is not deleted by its destructor.
  983.  
  984.    You can use all the `istream', `ostream', and `ios' methods with an
  985. `iostream' object.
  986.  
  987. File: iostream,  Node: Files and Strings,  Next: Streambuf,  Prev: Streams,  Up: Top
  988.  
  989. Classes for Files and Strings
  990. *****************************
  991.  
  992.    There are two very common special cases of input and output: using
  993. files, and using strings in memory.
  994.  
  995.    `libio' defines four specialized classes for these cases:
  996.  
  997. `ifstream'
  998.      Methods for reading files.
  999.  
  1000. `ofstream'
  1001.      Methods for writing files.
  1002.  
  1003. `istrstream'
  1004.      Methods for reading strings from memory.
  1005.  
  1006. `ostrstream'
  1007.      Methods for writing strings in memory.
  1008.  
  1009. * Menu:
  1010.  
  1011. * Files::    Reading and writing files.
  1012. * Strings::    Reading and writing strings in memory.
  1013.  
  1014. File: iostream,  Node: Files,  Next: Strings,  Up: Files and Strings
  1015.  
  1016. Reading and writing files
  1017. =========================
  1018.  
  1019.    These methods are declared in `fstream.h'.
  1020.  
  1021.    You can read data from class `ifstream' with any operation from class
  1022. `istream'.  There are also a few specialized facilities:
  1023.  
  1024.  - Constructor:  ifstream::ifstream ()
  1025.      Make an `ifstream' associated with a new file for input.  (If you
  1026.      use this version of the constructor, you need to call
  1027.      `ifstream::open' before actually reading anything)
  1028.  
  1029.  - Constructor:  ifstream::ifstream (int FD)
  1030.      Make an `ifstream' for reading from a file that was already open,
  1031.      using file descriptor FD.  (This constructor is compatible with
  1032.      other versions of iostreams for POSIX systems, but is not part of
  1033.      the ANSI working paper.)
  1034.  
  1035.  - Constructor:  ifstream::ifstream (const char* FNAME [, int MODE
  1036.           [, int PROT]])
  1037.      Open a file `*FNAME' for this `ifstream' object.
  1038.  
  1039.      By default, the file is opened for input (with `ios::in' as MODE).
  1040.      If you use this constructor, the file will be closed when the
  1041.      `ifstream' is destroyed.
  1042.  
  1043.      You can use the optional argument MODE to specify how to open the
  1044.      file, by combining these enumerated values (with `|' bitwise or).
  1045.      (These values are actually defined in class `ios', so that all
  1046.      file-related streams may inherit them.)  Only some of these modes
  1047.      are defined in the latest draft ANSI specification; if portability
  1048.      is important, you may wish to avoid the others.
  1049.  
  1050.     `ios::in'
  1051.           Open for input.  (Included in ANSI draft.)
  1052.  
  1053.     `ios::out'
  1054.           Open for output.  (Included in ANSI draft.)
  1055.  
  1056.     `ios::ate'
  1057.           Set the initial input (or output) position to the end of the
  1058.           file.
  1059.  
  1060.     `ios::app'
  1061.           Seek to end of file before each write.  (Included in ANSI
  1062.           draft.)
  1063.  
  1064.     `ios::trunc'
  1065.           Guarantee a fresh file; discard any contents that were
  1066.           previously associated with it.
  1067.  
  1068.     `ios::nocreate'
  1069.           Guarantee an existing file; fail if the specified file did
  1070.           not already exist.
  1071.  
  1072.     `ios::noreplace'
  1073.           Guarantee a new file; fail if the specified file already
  1074.           existed.
  1075.  
  1076.     `ios::bin'
  1077.           Open as a binary file (on systems where binary and text files
  1078.           have different properties, typically how `\n' is mapped;
  1079.           included in ANSI draft).
  1080.  
  1081.      The last optional argument PROT is specific to Unix-like systems;
  1082.      it specifies the file protection (by default `644').
  1083.  
  1084.  - Method: void ifstream::open (const char* FNAME [, int MODE [, int
  1085.           PROT]])
  1086.      Open a file explicitly after the associated `ifstream' object
  1087.      already exists (for instance, after using the default
  1088.      constructor).  The arguments, options and defaults all have the
  1089.      same meanings as in the fully specified `ifstream' constructor.
  1090.  
  1091.    You can write data to class `ofstream' with any operation from class
  1092. `ostream'.  There are also a few specialized facilities:
  1093.  
  1094.  - Constructor:  ofstream::ofstream ()
  1095.      Make an `ofstream' associated with a new file for output.
  1096.  
  1097.  - Constructor:  ofstream::ofstream (int FD)
  1098.      Make an `ofstream' for writing to a file that was already open,
  1099.      using file descriptor FD.
  1100.  
  1101.  - Constructor:  ofstream::ofstream (const char* FNAME [, int MODE
  1102.           [, int PROT]])
  1103.      Open a file `*FNAME' for this `ofstream' object.
  1104.  
  1105.      By default, the file is opened for output (with `ios::out' as
  1106.      MODE).  You can use the optional argument MODE to specify how to
  1107.      open the file, just as described for `ifstream::ifstream'.
  1108.  
  1109.      The last optional argument PROT specifies the file protection (by
  1110.      default `644').
  1111.  
  1112.  - Destructor:  ofstream::~ofstream ()
  1113.      The files associated with `ofstream' objects are closed when the
  1114.      corresponding object is destroyed.
  1115.  
  1116.  - Method: void ofstream::open (const char* FNAME [, int MODE [, int
  1117.           PROT]])
  1118.      Open a file explicitly after the associated `ofstream' object
  1119.      already exists (for instance, after using the default
  1120.      constructor).  The arguments, options and defaults all have the
  1121.      same meanings as in the fully specified `ofstream' constructor.
  1122.  
  1123.    The class `fstream' combines the facilities of `ifstream' and
  1124. `ofstream', just as `iostream' combines `istream' and `ostream'.
  1125.  
  1126.    The class `fstreambase' underlies both `ifstream' and `ofstream'.
  1127. They both inherit this additional method:
  1128.  
  1129.  - Method: void fstreambase::close ()
  1130.      Close the file associated with this object, and set `ios::fail' in
  1131.      this object to mark the event.
  1132.  
  1133. File: iostream,  Node: Strings,  Prev: Files,  Up: Files and Strings
  1134.  
  1135. Reading and writing in memory
  1136. =============================
  1137.  
  1138.    The classes `istrstream', `ostrstream', and `strstream' provide some
  1139. additional features for reading and writing strings in memory--both
  1140. static strings, and dynamically allocated strings.  The underlying
  1141. class `strstreambase' provides some features common to all three;
  1142. `strstreambuf' underlies that in turn.
  1143.  
  1144.  - Constructor:  istrstream::istrstream (const char* STR [, int SIZE])
  1145.      Associate the new input string class `istrstream' with an existing
  1146.      static string starting at STR, of size SIZE.  If you do not
  1147.      specify SIZE, the string is treated as a `NUL' terminated string.
  1148.  
  1149.  - Constructor:  ostrstream::ostrstream ()
  1150.      Create a new stream for output to a dynamically managed string,
  1151.      which will grow as needed.
  1152.  
  1153.  - Constructor:  ostrstream::ostrstream (char* STR, int SIZE [,int
  1154.           MODE])
  1155.      A new stream for output to a statically defined string of length
  1156.      SIZE, starting at STR.  You may optionally specify one of the
  1157.      modes described for `ifstream::ifstream'; if you do not specify
  1158.      one, the new stream is simply open for output, with mode
  1159.      `ios::out'.
  1160.  
  1161.  - Method: int ostrstream::pcount ()
  1162.      Report the current length of the string associated with this
  1163.      `ostrstream'.
  1164.  
  1165.  - Method: char* ostrstream::str ()
  1166.      A pointer to the string managed by this `ostrstream'.  Implies
  1167.      `ostrstream::freeze()'.
  1168.  
  1169.      Note that if you want the string to be nul-terminated, you must do
  1170.      that yourself (perhaps by writing ends to the stream).
  1171.  
  1172.  - Method: void ostrstream::freeze ([int N])
  1173.      If N is nonzero (the default), declare that the string associated
  1174.      with this `ostrstream' is not to change dynamically; while frozen,
  1175.      it will not be reallocated if it needs more space, and it will not
  1176.      be deallocated when the `ostrstream' is destroyed.  Use
  1177.      `freeze(1)' if you refer to the string as a pointer after creating
  1178.      it via `ostrstream' facilities.
  1179.  
  1180.      `freeze(0)' cancels this declaration, allowing a dynamically
  1181.      allocated string to be freed when its `ostrstream' is destroyed.
  1182.  
  1183.      If this `ostrstream' is already static--that is, if it was created
  1184.      to manage an existing statically allocated string--`freeze' is
  1185.      unnecessary, and has no effect.
  1186.  
  1187.  - Method: int ostrstream::frozen ()
  1188.      Test whether `freeze(1)' is in effect for this string.
  1189.  
  1190.  - Method: strstreambuf* strstreambase::rdbuf ()
  1191.      A pointer to the underlying `strstreambuf'.
  1192.  
  1193. File: iostream,  Node: Streambuf,  Next: Stdio,  Prev: Files and Strings,  Up: Top
  1194.  
  1195. Using the `streambuf' Layer
  1196. ***************************
  1197.  
  1198.    The `istream' and `ostream' classes are meant to handle conversion
  1199. between objects in your program and their textual representation.
  1200.  
  1201.    By contrast, the underlying `streambuf' class is for transferring
  1202. raw bytes between your program, and input sources or output sinks.
  1203. Different `streambuf' subclasses connect to different kinds of sources
  1204. and sinks.
  1205.  
  1206.    The GNU implementation of `streambuf' is still evolving; we describe
  1207. only some of the highlights.
  1208.  
  1209. * Menu:
  1210.  
  1211. * Areas::        Areas in a streambuf.
  1212. * Overflow::        Simple output re-direction
  1213. * Formatting::        C-style formatting for streambuf objects.
  1214. * Stdiobuf::        Wrappers for C stdio.
  1215. * Procbuf::             Reading/writing from/to a pipe
  1216. * Backing Up::        Marking and returning to a position.
  1217. * Indirectbuf::        Forwarding I/O activity.
  1218.  
  1219. File: iostream,  Node: Areas,  Next: Overflow,  Up: Streambuf
  1220.  
  1221. Areas of a `streambuf'
  1222. ======================
  1223.  
  1224.    Streambuf buffer management is fairly sophisticated (this is a nice
  1225. way to say "complicated").  The standard protocol has the following
  1226. "areas":
  1227.  
  1228.    * The "put area" contains characters waiting for output.
  1229.  
  1230.    * The "get area" contains characters available for reading.
  1231.  
  1232.    The GNU `streambuf' design extends this, but the details are still
  1233. evolving.
  1234.  
  1235.    The following methods are used to manipulate these areas.  These are
  1236. all protected methods, which are intended to be used by virtual
  1237. function in classes derived from `streambuf'.  They are also all
  1238. ANSI/ISO-standard, and the ugly names are traditional.  (Note that if a
  1239. pointer points to the 'end' of an area, it means that it points to the
  1240. character after the area.)
  1241.  
  1242.  - Method: char* streambuf::pbase () const
  1243.      Returns a pointer to the start of the put area.
  1244.  
  1245.  - Method: char* streambuf::epptr () const
  1246.      Returns a pointer to the end of the put area.
  1247.  
  1248.  - Method: char* streambuf::pptr () const
  1249.      If `pptr() < epptr ()', the `pptr()' returns a pointer to the
  1250.      current put position.  (In that case, the next write will
  1251.      overwrite `*pptr()', and increment `pptr()'.) Otherwise, there is
  1252.      no put position available (and the next character written will
  1253.      cause `streambuf::overflow' to be called).
  1254.  
  1255.  - Method: void streambuf::pbump (int N)
  1256.      Add N to the current put pointer.  No error checking is done.
  1257.  
  1258.  - Method: void streambuf::setp (char* P, char* E)
  1259.      Sets the start of the put area to P, the end of the put area to E,
  1260.      and the current put pointer to P (also).
  1261.  
  1262.  - Method: char* streambuf::eback () const
  1263.      Returns a pointer to the start of the get area.
  1264.  
  1265.  - Method: char* streambuf::egptr () const
  1266.      Returns a pointer to the end of the get area.
  1267.  
  1268.  - Method: char* streambuf::gptr () const
  1269.      If `gptr() < egptr ()', then `gptr()' returns a pointer to the
  1270.      current get position.  (In that case the next read will read
  1271.      `*gptr()', and possibly increment `gptr()'.) Otherwise, there is
  1272.      no read position available (and the next read will cause
  1273.      `streambuf::underflow' to be called).
  1274.  
  1275.  - Method: void streambuf:gbump (int N)
  1276.      Add N to the current get pointer.  No error checking is done.
  1277.  
  1278.  - Method: void streambuf::setg (char* B, char* P, char* E)
  1279.      Sets the start of the get area to B, the end of the get area to E,
  1280.      and the current put pointer to P.
  1281.  
  1282. File: iostream,  Node: Overflow,  Next: Formatting,  Prev: Areas,  Up: Streambuf
  1283.  
  1284. Simple output re-direction by redefining `overflow'
  1285. ===================================================
  1286.  
  1287.    Suppose you have a function `write_to_window' that writes characters
  1288. to a `window' object.  If you want to use the ostream function to write
  1289. to it, here is one (portable) way to do it.  This depends on the
  1290. default buffering (if any).
  1291.  
  1292.      #include <iostream.h>
  1293.      /* Returns number of characters successfully written to WIN. */
  1294.      extern int write_to_window (window* win, char* text, int length);
  1295.      
  1296.      class windowbuf : public streambuf {
  1297.          window* win;
  1298.        public:
  1299.          windowbuf (window* w) { win = w; }
  1300.          int sync ();
  1301.          int overflow (int ch);
  1302.          // Defining xsputn is an optional optimization.
  1303.          // (streamsize was recently added to ANSI C++, not portable yet.)
  1304.          streamsize xsputn (char* text, streamsize n);
  1305.      };
  1306.      
  1307.      int windowbuf::sync ()
  1308.      { streamsize n = pptr () - pbase ();
  1309.        return (n && write_to_window (win, pbase (), n) != n) ? EOF : 0;
  1310.      }
  1311.      
  1312.      int windowbuf::overflow (int ch)
  1313.      { streamsize n = pptr () - pbase ();
  1314.        if (n && sync ())
  1315.          return EOF;
  1316.        if (ch != EOF)
  1317.          {
  1318.            char cbuf[1];
  1319.            cbuf[0] = ch;
  1320.            if (write_to_window (win, cbuf, 1) != 1)
  1321.              return EOF;
  1322.          }
  1323.        pbump (-n);  // Reset pptr().
  1324.        return 0;
  1325.      }
  1326.      
  1327.      streamsize windowbuf::xsputn (char* text, streamsize n)
  1328.      { return sync () == EOF ? 0 : write_to_window (win, text, n); }
  1329.      
  1330.      int
  1331.      main (int argc, char**argv)
  1332.      {
  1333.        window *win = ...;
  1334.        windowbuf wbuf(win);
  1335.        ostream wstr(&wbuf);
  1336.        wstr << "Hello world!\n";
  1337.      }
  1338.  
  1339. File: iostream,  Node: Formatting,  Next: Stdiobuf,  Prev: Overflow,  Up: Streambuf
  1340.  
  1341. C-style formatting for `streambuf' objects
  1342. ==========================================
  1343.  
  1344.    The GNU `streambuf' class supports `printf'-like formatting and
  1345. scanning.
  1346.  
  1347.  - Method: int streambuf::vform (const char *FORMAT, ...)
  1348.      Similar to `fprintf(FILE, FORMAT, ...)'.  The FORMAT is a
  1349.      `printf'-style format control string, which is used to format the
  1350.      (variable number of) arguments, printing the result on the `this'
  1351.      streambuf.  The result is the number of characters printed.
  1352.  
  1353.  - Method: int streambuf::vform (const char *FORMAT, va_list ARGS)
  1354.      Similar to `vfprintf(FILE, FORMAT, ARGS)'.  The FORMAT is a
  1355.      `printf'-style format control string, which is used to format the
  1356.      argument list ARGS, printing the result on the `this' streambuf.
  1357.      The result is the number of characters printed.
  1358.  
  1359.  - Method: int streambuf::scan (const char *FORMAT, ...)
  1360.      Similar to `fscanf(FILE, FORMAT, ...)'.  The FORMAT is a
  1361.      `scanf'-style format control string, which is used to read the
  1362.      (variable number of) arguments from the `this' streambuf.  The
  1363.      result is the number of items assigned, or `EOF' in case of input
  1364.      failure before any conversion.
  1365.  
  1366.  - Method: int streambuf::vscan (const char *FORMAT, va_list ARGS)
  1367.      Like `streambuf::scan', but takes a single `va_list' argument.
  1368.  
  1369. File: iostream,  Node: Stdiobuf,  Next: Procbuf,  Prev: Formatting,  Up: Streambuf
  1370.  
  1371. Wrappers for C `stdio'
  1372. ======================
  1373.  
  1374.    A "stdiobuf" is a `streambuf' object that points to a `FILE' object
  1375. (as defined by `stdio.h').  All `streambuf' operations on the
  1376. `stdiobuf' are forwarded to the `FILE'.  Thus the `stdiobuf' object
  1377. provides a wrapper around a `FILE', allowing use of `streambuf'
  1378. operations on a `FILE'.  This can be useful when mixing C code with C++
  1379. code.
  1380.  
  1381.    The pre-defined streams `cin', `cout', and `cerr' are normally
  1382. implemented as `stdiobuf' objects that point to respectively `stdin',
  1383. `stdout', and `stderr'.  This is convenient, but it does cost some
  1384. extra overhead.
  1385.  
  1386.    If you set things up to use the implementation of `stdio' provided
  1387. with this library, then `cin', `cout', and `cerr' will be set up to to
  1388. use `stdiobuf' objects, since you get their benefits for free.  *Note C
  1389. Input and Output: Stdio.
  1390.  
  1391. File: iostream,  Node: Procbuf,  Next: Backing Up,  Prev: Stdiobuf,  Up: Streambuf
  1392.  
  1393. Reading/writing from/to a pipe
  1394. ==============================
  1395.  
  1396.    The "procbuf" class is a GNU extension.  It is derived from
  1397. `streambuf'.  A `procbuf' can be "closed" (in which case it does
  1398. nothing), or "open" (in which case it allows communicating through a
  1399. pipe with some other program).
  1400.  
  1401.  - Constructor:  procbuf::procbuf ()
  1402.      Creates a `procbuf' in a "closed" state.
  1403.  
  1404.  - Method: procbuf* procbuf::open (const char *COMMAND, int MODE)
  1405.      Uses the shell (`/bin/sh') to run a program specified by COMMAND.
  1406.  
  1407.      If MODE is `ios::in', standard output from the program is sent to
  1408.      a pipe; you can read from the pipe by reading from the `procbuf'.
  1409.      (This is similar to `popen(COMMAND, "r")'.)
  1410.  
  1411.      If MODE is `ios::out', output written written to the `procbuf' is
  1412.      written to a pipe; the program is set up to read its standard
  1413.      input from (the other end of) the pipe.  (This is similar to
  1414.      `popen(COMMAND, "w")'.)
  1415.  
  1416.      The `procbuf' must start out in the "closed" state.  Returns
  1417.      `*this' on success, and `NULL' on failure.
  1418.  
  1419.  - Constructor:  procbuf::procbuf (const char *COMMAND, int MODE)
  1420.      Calls `procbuf::open (COMMAND, MODE)'.
  1421.  
  1422.  - Method: procbuf* procbuf::close ()
  1423.      Waits for the program to finish executing, and then cleans up the
  1424.      resources used.  Returns `*this' on success, and `NULL' on failure.
  1425.  
  1426.  - Destructor:  procbuf::~procbuf ()
  1427.      Calls `procbuf::close'.
  1428.  
  1429. File: iostream,  Node: Backing Up,  Next: Indirectbuf,  Prev: Procbuf,  Up: Streambuf
  1430.  
  1431. Backing up
  1432. ==========
  1433.  
  1434.    The GNU iostream library allows you to ask a `streambuf' to remember
  1435. the current position.  This allows you to go back to this position
  1436. later, after reading further.  You can back up arbitrary amounts, even
  1437. on unbuffered files or multiple buffers' worth, as long as you tell the
  1438. library in advance.  This unbounded backup is very useful for scanning
  1439. and parsing applications.  This example shows a typical scenario:
  1440.  
  1441.      // Read either "dog", "hound", or "hounddog".
  1442.      // If "dog" is found, return 1.
  1443.      // If "hound" is found, return 2.
  1444.      // If "hounddog" is found, return 3.
  1445.      // If none of these are found, return -1.
  1446.      int my_scan(streambuf* sb)
  1447.      {
  1448.          streammarker fence(sb);
  1449.          char buffer[20];
  1450.          // Try reading "hounddog":
  1451.          if (sb->sgetn(buffer, 8) == 8
  1452.              && strncmp(buffer, "hounddog", 8) == 0)
  1453.            return 3;
  1454.          // No, no "hounddog":  Back up to 'fence'
  1455.          sb->seekmark(fence); //
  1456.          // ... and try reading "dog":
  1457.          if (sb->sgetn(buffer, 3) == 3
  1458.              && strncmp(buffer, "dog", 3) == 0)
  1459.            return 1;
  1460.          // No, no "dog" either:  Back up to 'fence'
  1461.          sb->seekmark(fence); //
  1462.          // ... and try reading "hound":
  1463.          if (sb->sgetn(buffer, 5) == 5
  1464.              && strncmp(buffer, "hound", 5) == 0)
  1465.            return 2;
  1466.          // No, no "hound" either:  Back up and signal failure.
  1467.          sb->seekmark(fence); // Backup to 'fence'
  1468.          return -1;
  1469.      }
  1470.  
  1471.  - Constructor:  streammarker::streammarker (streambuf* SBUF)
  1472.      Create a `streammarker' associated with SBUF that remembers the
  1473.      current position of the get pointer.
  1474.  
  1475.  - Method: int streammarker::delta (streammarker& MARK2)
  1476.      Return the difference between the get positions corresponding to
  1477.      `*this' and MARK2 (which must point into the same `streambuffer'
  1478.      as `this').
  1479.  
  1480.  - Method: int streammarker::delta ()
  1481.      Return the position relative to the streambuffer's current get
  1482.      position.
  1483.  
  1484.  - Method: int streambuf::seekmark (streammarker& MARK)
  1485.      Move the get pointer to where it (logically) was when MARK was
  1486.      constructed.
  1487.  
  1488. File: iostream,  Node: Indirectbuf,  Prev: Backing Up,  Up: Streambuf
  1489.  
  1490. Forwarding I/O activity
  1491. =======================
  1492.  
  1493.    An "indirectbuf" is one that forwards all of its I/O requests to
  1494. another streambuf.
  1495.  
  1496.    An `indirectbuf' can be used to implement Common Lisp
  1497. synonym-streams and two-way-streams:
  1498.  
  1499.      class synonymbuf : public indirectbuf {
  1500.         Symbol *sym;
  1501.         synonymbuf(Symbol *s) { sym = s; }
  1502.         virtual streambuf *lookup_stream(int mode) {
  1503.             return coerce_to_streambuf(lookup_value(sym)); }
  1504.      };
  1505.  
  1506. File: iostream,  Node: Stdio,  Next: Index,  Prev: Streambuf,  Up: Top
  1507.  
  1508. C Input and Output
  1509. ******************
  1510.  
  1511.    `libio' is distributed with a complete implementation of the ANSI C
  1512. `stdio' facility.  It is implemented using `streambuf' objects.  *Note
  1513. Wrappers for C `stdio': Stdiobuf.
  1514.  
  1515.    The `stdio' package is intended as a replacement for the whatever
  1516. `stdio' is in your C library.  Since `stdio' works best when you build
  1517. `libc' to contain it, and that may be inconvenient, it is not installed
  1518. by default.
  1519.  
  1520.    Extensions beyond ANSI:
  1521.  
  1522.    * A stdio `FILE' is identical to a streambuf.  Hence there is no
  1523.      need to worry about synchronizing C and C++ input/output--they are
  1524.      by definition always synchronized.
  1525.  
  1526.    * If you create a new streambuf sub-class (in C++), you can use it
  1527.      as a `FILE' from C.  Thus the system is extensible using the
  1528.      standard `streambuf' protocol.
  1529.  
  1530.    * You can arbitrarily mix reading and writing, without having to seek
  1531.      in between.
  1532.  
  1533.    * Unbounded `ungetc()' buffer.
  1534.  
  1535. File: iostream,  Node: Index,  Prev: Stdio,  Up: Top
  1536.  
  1537. Index
  1538. *****
  1539.  
  1540. * Menu:
  1541.  
  1542. * (:                                    States.
  1543. * (:                                    States.
  1544. * << on ostream:                        Operators.
  1545. * >> on istream:                        Operators.
  1546. * iostream destructor:                  Iostream.
  1547. * badbit:                               States.
  1548. * beg:                                  Output Position.
  1549. * cerr:                                 Operators.
  1550. * cin:                                  Operators.
  1551. * class fstreambase:                    Files.
  1552. * class fstream:                        Files.
  1553. * class ifstream:                       Files.
  1554. * class istrstream:                     Strings.
  1555. * class ostream:                        Files.
  1556. * class ostrstream:                     Strings.
  1557. * class strstreambase:                  Strings.
  1558. * class strstreambuf:                   Strings.
  1559. * class strstream:                      Strings.
  1560. * cout:                                 Operators.
  1561. * cur:                                  Output Position.
  1562. * dec:                                  Manipulators.
  1563. * destructor for iostream:              Iostream.
  1564. * end:                                  Output Position.
  1565. * endl:                                 Manipulators.
  1566. * ends:                                 Manipulators.
  1567. * eofbit:                               States.
  1568. * failbit:                              States.
  1569. * flush:                                Ostream Housekeeping.
  1570. * flush:                                Manipulators.
  1571. * fstream:                              Files.
  1572. * fstreambase:                          Files.
  1573. * fstreambase::close:                   Files.
  1574. * get area:                             Areas.
  1575. * goodbit:                              States.
  1576. * hex:                                  Manipulators.
  1577. * ifstream:                             Files and Strings.
  1578. * ifstream:                             Files.
  1579. * ifstream::ifstream:                   Files.
  1580. * ifstream::ifstream:                   Files.
  1581. * ifstream::ifstream:                   Files.
  1582. * ifstream::open:                       Files.
  1583. * ios::app:                             Files.
  1584. * ios::ate:                             Files.
  1585. * ios::bad:                             States.
  1586. * ios::beg:                             Input Position.
  1587. * ios::bin:                             Files.
  1588. * ios::bitalloc:                        Extending.
  1589. * ios::clear:                           States.
  1590. * ios::cur:                             Input Position.
  1591. * ios::dec:                             Format Control.
  1592. * ios::end:                             Input Position.
  1593. * ios::eof:                             States.
  1594. * ios::fail:                            States.
  1595. * ios::fill:                            Format Control.
  1596. * ios::fill:                            Format Control.
  1597. * ios::fixed:                           Format Control.
  1598. * ios::flags:                           Format Control.
  1599. * ios::flags:                           Format Control.
  1600. * ios::good:                            States.
  1601. * ios::hex:                             Format Control.
  1602. * ios::in:                              Files.
  1603. * ios::internal:                        Format Control.
  1604. * ios::ios:                             Ios.
  1605. * ios::iword:                           Extending.
  1606. * ios::iword:                           Extending.
  1607. * ios::left:                            Format Control.
  1608. * ios::nocreate:                        Files.
  1609. * ios::noreplace:                       Files.
  1610. * ios::oct:                             Format Control.
  1611. * ios::out:                             Files.
  1612. * ios::precision:                       Format Control.
  1613. * ios::precision:                       Format Control.
  1614. * ios::pword:                           Extending.
  1615. * ios::pword:                           Extending.
  1616. * ios::rdbuf:                           Streambuf from Ios.
  1617. * ios::rdstate:                         States.
  1618. * ios::right:                           Format Control.
  1619. * ios::scientific:                      Format Control.
  1620. * ios::seekdir:                         Output Position.
  1621. * ios::set:                             States.
  1622. * ios::setf:                            Format Control.
  1623. * ios::setf:                            Format Control.
  1624. * ios::setstate:                        States.
  1625. * ios::showbase:                        Format Control.
  1626. * ios::showpoint:                       Format Control.
  1627. * ios::showpos:                         Format Control.
  1628. * ios::skipws:                          Format Control.
  1629. * ios::stdio:                           Format Control.
  1630. * ios::sync_with_stdio:                 Synchronization.
  1631. * ios::tie:                             Synchronization.
  1632. * ios::tie:                             Synchronization.
  1633. * ios::trunc:                           Files.
  1634. * ios::unitbuf:                         Format Control.
  1635. * ios::unsetf:                          Format Control.
  1636. * ios::uppercase:                       Format Control.
  1637. * ios::width:                           Format Control.
  1638. * ios::width:                           Format Control.
  1639. * ios::xalloc:                          Extending.
  1640. * ios::~ios:                            Ios.
  1641. * iostream::iostream:                   Iostream.
  1642. * iostream::iostream:                   Iostream.
  1643. * istream::gcount:                      Istream Housekeeping.
  1644. * istream::get:                         Char Input.
  1645. * istream::get:                         String Input.
  1646. * istream::get:                         String Input.
  1647. * istream::get:                         Char Input.
  1648. * istream::getline:                     String Input.
  1649. * istream::gets:                        String Input.
  1650. * istream::ignore:                      Istream Housekeeping.
  1651. * istream::ipfx:                        Istream Housekeeping.
  1652. * istream::isfx:                        Istream Housekeeping.
  1653. * istream::istream:                     Istream.
  1654. * istream::istream:                     Istream.
  1655. * istream::peek:                        Char Input.
  1656. * istream::putback:                     Istream Housekeeping.
  1657. * istream::read:                        String Input.
  1658. * istream::scan:                        String Input.
  1659. * istream::seekg:                       Input Position.
  1660. * istream::seekg:                       Input Position.
  1661. * istream::tellg:                       Input Position.
  1662. * istream::unget:                       Istream Housekeeping.
  1663. * istream::vscan:                       String Input.
  1664. * istrstream:                           Files and Strings.
  1665. * istrstream:                           Strings.
  1666. * istrstream::istrstream:               Strings.
  1667. * oct:                                  Manipulators.
  1668. * ofstream:                             Files and Strings.
  1669. * ofstream::ofstream:                   Files.
  1670. * ofstream::ofstream:                   Files.
  1671. * ofstream::ofstream:                   Files.
  1672. * ofstream::open:                       Files.
  1673. * ofstream::~ofstream:                  Files.
  1674. * ostream:                              Files.
  1675. * ostream::form:                        Writing.
  1676. * ostream::opfx:                        Ostream Housekeeping.
  1677. * ostream::osfx:                        Ostream Housekeeping.
  1678. * ostream::ostream:                     Ostream.
  1679. * ostream::ostream:                     Ostream.
  1680. * ostream::put:                         Writing.
  1681. * ostream::seekp:                       Output Position.
  1682. * ostream::seekp:                       Output Position.
  1683. * ostream::tellp:                       Output Position.
  1684. * ostream::vform:                       Writing.
  1685. * ostream::write:                       Writing.
  1686. * ostrstream:                           Strings.
  1687. * ostrstream:                           Files and Strings.
  1688. * ostrstream::freeze:                   Strings.
  1689. * ostrstream::frozen:                   Strings.
  1690. * ostrstream::ostrstream:               Strings.
  1691. * ostrstream::ostrstream:               Strings.
  1692. * ostrstream::pcount:                   Strings.
  1693. * ostrstream::str:                      Strings.
  1694. * procbuf::close:                       Procbuf.
  1695. * procbuf::open:                        Procbuf.
  1696. * procbuf::procbuf:                     Procbuf.
  1697. * procbuf::procbuf:                     Procbuf.
  1698. * procbuf::~procbuf:                    Procbuf.
  1699. * put area:                             Areas.
  1700. * setbase:                              Manipulators.
  1701. * setfill:                              Manipulators.
  1702. * setprecision:                         Manipulators.
  1703. * setprecision:                         Format Control.
  1704. * setting ios::precision:               Format Control.
  1705. * setting ios::width:                   Format Control.
  1706. * setw:                                 Format Control.
  1707. * setw:                                 Manipulators.
  1708. * streambuf::eback:                     Areas.
  1709. * streambuf::egptr:                     Areas.
  1710. * streambuf::epptr:                     Areas.
  1711. * streambuf::gptr:                      Areas.
  1712. * streambuf::pbase:                     Areas.
  1713. * streambuf::pbump:                     Areas.
  1714. * streambuf::pptr:                      Areas.
  1715. * streambuf::scan:                      Formatting.
  1716. * streambuf::seekmark:                  Backing Up.
  1717. * streambuf::setg:                      Areas.
  1718. * streambuf::setp:                      Areas.
  1719. * streambuf::vform:                     Formatting.
  1720. * streambuf::vform:                     Formatting.
  1721. * streambuf::vscan:                     Formatting.
  1722. * streambuf:gbump:                      Areas.
  1723. * streammarker::delta:                  Backing Up.
  1724. * streammarker::delta:                  Backing Up.
  1725. * streammarker::streammarker:           Backing Up.
  1726. * strstream:                            Strings.
  1727. * strstreambase:                        Strings.
  1728. * strstreambase::rdbuf:                 Strings.
  1729. * strstreambuf:                         Strings.
  1730. * ws:                                   Manipulators.
  1731.  
  1732.  
  1733. Tag Table:
  1734. Node: Top989
  1735. Node: Introduction1470
  1736. Node: Copying2035
  1737. Node: Acknowledgements3243
  1738. Node: Operators4222
  1739. Node: Streams6982
  1740. Node: Ios7459
  1741. Node: States9055
  1742. Node: Format Control12028
  1743. Node: Manipulators17184
  1744. Node: Extending19152
  1745. Node: Synchronization20946
  1746. Node: Streambuf from Ios22255
  1747. Node: Ostream22600
  1748. Node: Writing23729
  1749. Node: Output Position25101
  1750. Node: Ostream Housekeeping26254
  1751. Node: Istream27505
  1752. Node: Char Input28877
  1753. Node: String Input29468
  1754. Node: Input Position32971
  1755. Node: Istream Housekeeping34173
  1756. Node: Iostream36473
  1757. Node: Files and Strings37759
  1758. Node: Files38381
  1759. Node: Strings43000
  1760. Node: Streambuf45574
  1761. Node: Areas46503
  1762. Node: Overflow48997
  1763. Node: Formatting50802
  1764. Node: Stdiobuf52209
  1765. Node: Procbuf53145
  1766. Node: Backing Up54647
  1767. Node: Indirectbuf56907
  1768. Node: Stdio57444
  1769. Node: Index58467
  1770. End Tag Table
  1771.